import logo from './logo.svg';
import './App.css';
import React, { forwardRef, useCallback, useEffect, useState } from 'react';
import { click } from '@testing-library/user-event/dist/click';
import { useMemo,useRef} from 'react';

const Bppref=forwardRef(function (props,ref){
  return (<div>
      <input ref={ref} type='text'/>
  </div>)
})

function App(){

  const inputRef=useRef(null)
  
  useEffect(()=>{
    console.log('inputRef useEffect中执行的',inputRef);
    // inputRef.current.focus()
  },[])

   return (
    <div>
      <Bppref ref={inputRef}/>
      <button onClick={()=>inputRef.current.focus()}> focus input</button>
    </div>
   )
}

export default App;
